/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2010 UCL
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: João Taveira Araújo  <j.araujo@ucl.ac.uk> 
 */

#ifndef REFLEX_TRACE_H
#define REFLEX_TRACE_H

#include <stdint.h>
#include <string>
#include <ostream>
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/node-module.h"
#include "ns3/ppp-header.h"
#include "ns3/queue.h"
#include "ns3/point-to-point-net-device.h"
#include "ns3/trace-helper.h"


using namespace ns3;

class ReflexTraceQueue : public Object
{
public:
  static TypeId GetTypeId (void);  

  ReflexTraceQueue();
  ~ReflexTraceQueue();

  void SetDevice(std::string prefix, Ptr<NetDevice>);
  void LogQueue(std::string prefix, Ptr<NetDevice>);

  virtual Ptr<Packet> ProcessHeader(Ptr<const Packet> p) = 0;
  uint32_t GetReflex(Ptr<Packet> p);
  void Log(Ptr<const Packet> p);

  void TxDrop(Ptr<const Packet> p);
  void TxDequeue(Ptr<const Packet> p);
  void TxEnqueue(Ptr<const Packet> p);
 
private:
  std::ofstream ascii;
};                                            

class PppReflexTraceQueue : public ReflexTraceQueue
{
  static const uint16_t IP_PROTO_NUM = 33;
public:
  void LogQueue(std::string prefix, Ptr<NetDevice>);
  Ptr<Packet> ProcessHeader(Ptr<const Packet> p);
};     

#endif /* REFLEX_TRACE_H */

